<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="120px">
      <el-form-item label="预约姓名">
        <el-input v-model="form.username" />
      </el-form-item>
      <el-form-item label="预约模式">
        <el-select v-model="form.gameType" placeholder="选择模式">
          <el-option label="排位" value="rank" />
          <el-option label="匹配" value="normal" />
          <el-option label="特殊" value="unique" />
        </el-select>
      </el-form-item>
      <el-form-item label="预约时间">
        <el-col :span="11">
          <el-date-picker
            v-model="form.date1"
            type="date"
            placeholder="年-月-日"
            style="width: 100%"
          />
        </el-col>
        <el-col :span="2" class="line">-</el-col>
        <el-col :span="11">
          <el-time-picker
            v-model="form.date2"
            type="fixed-time"
            placeholder="时-分-秒"
            style="width: 100%"
          />
        </el-col>
      </el-form-item>
      <el-form-item label="期望人数">
        <el-radio-group v-removeAriaHidden v-model="form.loler">
          <el-radio label="1">一人</el-radio>
          <el-radio label="2">二人</el-radio>
          <el-radio label="3">三人</el-radio>
          <el-radio label="4">四人</el-radio>
          <el-radio label="5">五人</el-radio>
        </el-radio-group>
        <div style="font-size: 12px; color: #c1cc">TIPS：预约人数包含本人</div>
      </el-form-item>
      <el-form-item label="接受等待">
        <el-radio-group v-removeAriaHidden v-model="form.isWaiting">
          <el-radio label="agree">接受</el-radio>
          <el-radio label="deny">拒绝</el-radio>
        </el-radio-group>
        <div style="font-size: 12px; color: #c1cc">
          TIPS：若拒绝等待，您的预约消息将会在1H后自动取消
        </div>
      </el-form-item>
      <el-form-item label="预约留言">
        <el-input v-model="form.desc" type="textarea" />
      </el-form-item>
      <el-form-item>
        <el-popconfirm
          @onConfirm="handleConfirm"
          @onCancel="handleCancel"
          confirm-button-text="确认预约"
          cancel-button-text="取消预约"
          icon="el-icon-info"
          icon-color="orange"
          title="你正在预约，请稍后..."
        >
          <el-button slot="reference" type="primary" @click.native="onSubmit"
            >预约</el-button
          >
        </el-popconfirm>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        username: "",
        gameType: "",
        date1: "",
        date2: "",
        loler: "",
        isWaiting: "",
        desc: "",
      },
      // userInfo: {
      //   username: "",
      //   userId: "",
      //   sex: "",
      // },
    };
  },
  methods: {
    onSubmit() {},
    onCancel() {},
    // 确认框
    handleConfirm() {
      if (this.form.loler === "1") {
        this.$notify({
          title: "单排不准预约",
          message: "一人是单排，你真选啊！",
          type: "warning",
        });
      } else {
        console.log(this.form);
        this.$notify({
          title: "预约",
          message: "预约成功！",
          type: "success",
        });
      }
    },
    handleCancel() {
      this.$notify({
        title: "取消预约",
        message: "你已取消预约，重新预约需要等待60S",
        type: "warning",
        duration: 6000,
      });
    },
  },
};
</script>

<style scoped>
.line {
  text-align: center;
}
::v-deep .el-form-item__label {
  padding: 0 55px 0 0;
}
</style>
